<template>
	<view>
		<cu-custom bgColor="bg-gradual-fff" isBack="true">
			<block slot="content">导师</block>
		</cu-custom>
		<u-loading-page :loading="true" loading-text="loading..." v-if="showLoading"></u-loading-page>
		<view v-show="!showLoading">
			<view class="viewbox"></view>
			<view class="tutor_a">
				<TutorList :list="TutorList" is_type="2"></TutorList>
			</view>
			<loading-footer :status="status" :slot-empty="true">
				<view slot="empty" class="column-center" style="padding-top: 200rpx">
					<image class="img-null" src="/static/goods_null.png"></image>
					<text class="lighter">暂无记录</text>
				</view>
			</loading-footer>
		</view>
	</view>
</template>
<script>
import request from '@/common/request.js';	
import {
	loadingType
} from '@/utils/type';
export default {
	data() {
		return {
			showLoading:true,
			status: loadingType.LOADING,
			page: 1,
			limit:8,
			TutorList:[],
			uid:0
		}
	},
	onLoad: function (options) {
	  this.onRefresh();
	},
	onShow() {
		this.uid=uni.getStorageSync('uid');
	},
	onReachBottom: function() {
		this.getTutorListFun();
	},
	mounted() {
		
	},
	methods: {
		goPage(url) {
			uni.navigateTo({
				url
			});
		},
		onRefresh() {
			this.page = 1
			this.TutorList = []
			this.status = loadingType.LOADING
			this.$nextTick(() => {
				this.getTutorListFun();
			});
		},
		async getTutorListFun() {
			let {
				page,
				limit,
				TutorList,
				status
			} = this;
			if (status == loadingType.FINISHED) return;
			const paramsList = {
				page: page,
				size:limit,
				uid:this.uid,
			}
			let optsList = {
				url: 't-lists',
				method: 'post'
			};
			request.httpRequest(optsList, paramsList).then(res => {
				if(res.data.code == 200){
					if(page == 1) TutorList = []
					let {
						list,
						more
					} = res.data.data
					this.TutorList.push(...list)
					this.page = ++page
					if (!more) {
						this.status = loadingType.FINISHED
					}
					if (this.TutorList.length <= 0) {
						this.status = loadingType.EMPTY
					}
				} else {
					this.status = loadingType.ERROR
				}
				this.showLoading=false;
			});
		},
	}
}
</script>

<style  lang="scss" scoped>
	.tutor_a{
		width: 700rpx;
		margin: auto;
		overflow: hidden;
	}
	.tutor_a_a{
		width: 700rpx;
		overflow: hidden;
	}
	.tutor_a_a_a{
		width: 112rpx;
		height: 112rpx;
		float: left;
		margin-top: 20rpx;
	}
	.tutor_a_a_a image{
		width: 112rpx;
		height: 112rpx;
	}
	.tutor_a_a_b{
		padding: 20rpx 0;
		float: right;
		width: 566rpx;
		border-bottom: 1rpx solid #E8E8E8;
	}
	.tutor_a_a_b_a{
		overflow: hidden;
	}
	.tutor_a_a_b_a_a{
		float: left;
		font-family: Source Han Sans;
		font-size: 34rpx;
		font-weight: 500;
		line-height: 50rpx;
		text-align:left;
		color: #3D3D3D;
		line-height: 40rpx;
	}
	.tutor_a_a_b_a_b{
		float: right;
		font-family: Source Han Sans;
		font-size: 24rpx;
		font-weight: normal;
		line-height: 40rpx;
		color: #FF4D4F;
	}
	.tutor_a_a_b_b{
		border: 1rpx solid #999999;
		padding:5rpx 10rpx;
		overflow: hidden;
		float: left;
		border-radius: 10rpx;
		margin-top: 15rpx;
	}
	.tutor_a_a_b_b_a{
		float: left;
		font-family: Source Han Sans;
		font-size: 24rpx;
		font-weight: normal;
		line-height: 40rpx;
		color: #666666;
	}
	.tutor_a_a_b_b_a span{
		padding: 0 10rpx;
	}
	.tutor_a_a_b_c{
		font-family: Source Han Sans;
		font-size: 24rpx;
		font-weight: normal;
		line-height:40rpx;
		text-align:left;
		color: #999999;
		overflow: hidden;
		margin-top: 15rpx;
		width: 100%;
	}
	.tutor_a_a_b_c span{
		color:#E71102;
	}
</style>
